import Vue from 'vue'
import VueRouter from 'vue-router'
// import Recommend from '@/views/recommend/recommend';
// import Singer from '@/views/singer/singer';
// import Rank from '@/views/rank/rank';
// import Search from '@/views/search/search';
// import Square from '@/views/square/square';
// import SingerDetail from '@/components/singer-detail/singer-detail';
// import SongSheet from '@/components/songsheet/songsheet'
// import CommentsIndex from '@/base/comments/commentsIndex'

const Recommend = () => import( /* webpackChunkName: "Recommend" */ '@/views/recommend/recommend')
const Singer = () => import( /* webpackChunkName: "singer" */ '@/views/singer/singer')
const Rank = () => import( /* webpackChunkName: "rank" */ '@/views/rank/rank')
const Search = () => import( /* webpackChunkName: "search" */ '@/views/search/search')
const Square = () => import( /* webpackChunkName: "square" */ '@/views/square/square')
const SingerDetail = () => import( /* webpackChunkName: "SingerDetail" */ '@/components/singer-detail/singer-detail')
const SongSheet = () => import( /* webpackChunkName: "SongSheet" */ '@/components/songsheet/songsheet')
const CommentsIndex = () => import( /* webpackChunkName: "commentsIndex" */ '@/base/comments/commentsIndex')

// 用户登录
import userIndex from "@/views/user/userIndex.vue"
// import userLogin from "@/views/user/userLogin.vue"
const userLogin = () => import( /* webpackChunkName: "userLogin" */ '@/views/user/userLogin.vue')
const manageSheet = () => import( /* webpackChunkName: "userLogin" */ '@/views/user/manage-sheet/manage-sheet')
// 用户信息：
const userCenter = () => import( /* webpackChunkName: "userCenter" */ '@/components/user-center/user-center')


// Mv:
const MvDetail = () => import( /* webpackChunkName: "Mvdetail" */ '@/components/mv/mv-detail/mv-detail')

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: 'Recommend',
}, {
  path: '/recommend',
  name: 'recommend',
  component: Recommend,
  meta: {
    keepAlive: true
  }
}, {
  path: '/singer',
  name: 'singer',
  component: Singer,
  meta: {
    keepAlive: true
  },
  children: [{
    path: ':id',
    component: SingerDetail,
    meta: {
      keepAlive: true
    }
  }]
}, {
  path: '/rank',
  name: 'rank',
  component: Rank,
  meta: {
    keepAlive: true
  }
}, {
  path: '/search',
  name: 'search',
  component: Search,
  meta: {
    keepAlive: true
  }
}, {
  path: '/square',
  name: 'square',
  component: Square,
  meta: {
    keepAlive: true
  }
}, {
  path: '/songsheet',
  name: 'songsheet',
  component: SongSheet,
  meta: {
    keepAlive: false
  }
}, {
  path: '/comments',
  name: 'comments',
  component: CommentsIndex,
  meta: {
    keepAlive: false
  },
}, {
  path: '/MvDetail',
  name: 'MvDetail',
  component: MvDetail,
  meta: {
    keepAlive: false
  }
}]

const userRoutes = [{
  path: '/user',
  component: userIndex,
  meta: {
    keepAlive: false
  },
  children: [{
    path: '/user/login',
    component: userLogin,
    meta: {
      keepAlive: false
    },
  }, {
    path: '/user/manageSheet',
    component: manageSheet,
    name: 'manageSheet',
    meta: {
      keepAlive: false
    }
  }, {
    path: '/user/userCenter',
    component: userCenter,
    name: 'userCenter',
    meta: {
      keepAlive: false
    }
  }]
}]
const router = new VueRouter({
  routes: [...routes, ...userRoutes]
})

export default router
